package se.webbzon.boltzmann.login;

import java.util.Date;

public class HTTPCookie {
	
	// The name and value of the cookie
	final String name, value;
	
	// The domain and sub-domain path of the cookie
	final String domain, path;
	
	// The expire date of the cookie
	final Date expire;
	
	// Whatever the cookie has the "Secure" and "HttpOnly" flag set
	final boolean secure, httpOnly;
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a new HTTP cookie with the provided name and value. **/
	public HTTPCookie(String name, String value) {
		this(name,value,"","",null,false,false);
	}
	
	/** Creates a new HTTP cookie with the provided attributes. **/
	public HTTPCookie(String name, String value, String domain, String path, Date expire, boolean secure, boolean httpOnly) {
		this.name = name;
		this.value = value;
		this.domain = domain;
		this.path = path;
		this.expire = expire;
		this.secure = secure;
		this.httpOnly = httpOnly;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the name of the cookie. **/
	public String getName() {
		return name;
	}

	/** Returns the value of the cookie. **/
	public String getValue() {
		return value;
	}

	/** Returns the domain of the cookie. **/
	public String getDomain() {
		return domain;
	}

	/** Returns the path of the cookie. **/
	public String getPath() {
		return path;
	}

	/** Returns the expire date of the cookie. **/
	public Date getExpire() {
		return expire;
	}

	/** Returns true if the "Secure" flag is set for the cookie. **/
	public boolean isSecure() {
		return secure;
	}

	/** Returns true if the "HttpOnly" falg is set for the cookie. **/
	public boolean isHttpOnly() {
		return httpOnly;
	}

}
